<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>登录页面</title>
    <style type="text/css">
        body {
            background-color: #f1f1f1;
            font-family: Arial, sans-serif;
        }
        .container {
            margin: 100px auto;
            padding: 50px;
            background-color: #fff;
            border-radius: 10px;
            box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.2);
            width: 500px;
        }
        h1 {
            font-size: 36px;
            margin-bottom: 30px;
            color: #333;
            text-align: center;
        }
        label {
            font-size: 18px;
            font-weight: bold;
            color: #666;
            display: block;
            margin-bottom: 15px;
            margin-top: 30px;
        }
        input[type="text"], input[type="password"] {
            width: 100%;
            padding: 10px;
            font-size: 16px;
            border-radius: 5px;
            border: none;
            box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.2);
            margin-bottom: 30px;
        }
        input[type="submit"] {
            background-color: #4CAF50;
            color: white;
            padding: 10px 20px;
            border: none;
            border-radius: 5px;
            font-size: 18px;
            cursor: pointer;
        }
        input[type="submit"]:hover {
            background-color: #008CBA;
        }
        .error-msg {
            color: #ff0000;
            font-size: 14px;
            margin-top: 10px;
        }
    </style>
    <% String errMsg = (String)request.getAttribute("errMsg"); %>
    <% if (errMsg != null && !errMsg.isEmpty()) { %>
    <script type="text/javascript">
        alert("<%= errMsg %>");
    </script>
    <% } %>
</head>
<body>
<div class="container">
    <h1>登录页面</h1>
    <form method="post" action="login_action.jsp">
        <label>用户名</label>
        <input type="text" name="username" required>
        <label>密码</label>
        <input type="password" name="password" required>
        <input type="submit" value="登录"><br>
        <a  href="register.jsp"  style="text-decoration:  underline;  color:  #007bff;  font-weight:bold;">点击注册</a>

        <div class="error-msg">
            <%  errMsg = (String)request.getAttribute("errMsg"); %>
            <% if (errMsg != null && !errMsg.isEmpty()) { %>
            <%= errMsg %>
            <% } %>
        </div>
    </form>
</div>
</body>
</html>
